require 'mysql'

my = Mysql.new("10.10.13.155", "root", "iesb", "TESTE_UNREALDB")

puts "Start: " + Time.now.to_s
real_start = Time.now
times = []

250.times do |i|
  start = Time.now
  str = "SELECT * FROM FOTO WHERE foto_id = " + i.to_s
  if !my.query(str)
    puts "Erro ao buscar foto " + i.to_s
  end
 
  str2 = "SELECT * FROM COMENTARIO WHERE foto_fk = " + i.to_s
  if !my.query(str2)
    puts "Erro ao buscar comentario da foto " + i.to_s
  end
  times << (Time.now - start)
end

puts "Total: " + (Time.now - real_start).to_s
puts "Finish: " + Time.now.to_s
times.each{|t| puts t.to_s }

my.close
